package com.dayaokeji.server_api.api;

import com.dayaokeji.server_api.ServerResponse;
import com.dayaokeji.server_api.domain.CommitExam;
import com.dayaokeji.server_api.domain.Exam;
import com.dayaokeji.server_api.domain.ExamQuestion;
import com.dayaokeji.server_api.domain.TestResult;
import com.dayaokeji.server_api.domain.UpdateExam;

import java.util.List;

import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;

/**
 * Created by Gorden on 2017/10/18.
 * 题库相关API
 */

public interface ExamApi {

    /**
     * 查询考试列表
     * @param relId
     * @param relType
     * @return
     */
    @GET("course/exam/queryTestExamAll")
    Call<ServerResponse<List<Exam>>> list(
            @Query("relId") String relId,
            @Query("relType") int relType
    );

    /**
     * 老师查询考试成绩列表
     * @param id
     * @return
     */
    @GET("course/exam/queryExamGradeTeacher")
    Call<ServerResponse<List<TestResult>>> queryExamGradeTeacher(@Query("id") int id);


    /**
     * 开始考试（老师调用，开始后才允许学生交卷）
     * @param updateExam
     * @return
     */
    @POST("course/exam/ExamUnderway")
    Call<ServerResponse<Void>> examUnderway(@Body UpdateExam updateExam);

    /**
     * 结束考试
     * @param updateExam
     * @return
     */
    @POST("course/exam/ExamCompleted")
    Call<ServerResponse<Void>> examCompleted(@Body UpdateExam updateExam);

    /**
     * 删除考试
     * @param updateExam
     * @return
     */
    @POST("course/exam/deleteExam")
    Call<ServerResponse<Void>> deleteExam(@Body UpdateExam updateExam);

    /**
     * 查询考试题目列表
     * @param examId
     * @return
     */
    @GET("course/exam/queryExamQuestion")
    Call<ServerResponse<List<ExamQuestion>>> queryExamQuestion(@Query("examId") int examId,@Query("userId") String userId);


    /**
     * 查询考试结果
     * @param examId
     * @return
     */
    @GET("course/exam/queryStudentAnswerInfo")
    Call<ServerResponse<List<ExamQuestion>>> queryStudentAnswerInfo(@Query("examId") int examId,@Query("userId") String userId);

    /**
     * 交卷（学生调用）
     * @param commitExam
     * @return
     */
    @POST("course/exam/commitExam")
    Call<ServerResponse<Void>> commitExam(@Body CommitExam commitExam);
}
